<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>linear-gradient线性渐变</title>
    <style>
      .box {
        width: 300px;
        height: 200px;
        border: 1px solid black;
        float: left;
        margin-left: 50px;
      }
      .box::after {
        content: "";
        display: block;
        clear: both;
      }
      .box1 {
        background-image: linear-gradient(red, yellow, green);
      }
      .box2 {
        background-image: linear-gradient(to right top, red, yellow, green);
      }
      .box3 {
        background-image: linear-gradient(20deg, red, yellow, green);
      }
      .box4 {
        background-image: linear-gradient(red 50px, yellow 100px, green 150px);
      }
      .box5 {
        background-image: linear-gradient(
          180deg,
          red 50px,
          yellow 100px,
          green
        );
        font-size: 40px;
        text-align: center;
        line-height: 200px;
        font-weight: bold;
        color: transparent;
        background-clip: text;
      }
    </style>
  </head>
  <body>
    <div class="box box1">linear-gradient线性渐变，默认从上到下</div>
    <div class="box box2">通过关键词调整线性渐变渐变方向</div>
    <div class="box box3">通过角度调整线性渐变渐变方向</div>
    <div class="box box4">调整线性渐变的区域</div>
    <div class="box box5">线性渐变</div>
  </body>
</html>
